package org.cc.cloud;

import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;

import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.context.annotation.PropertySource;
import org.springframework.messaging.Message;

@SpringBootApplication
@EnableEurekaClient
@EnableBinding(Sink.class)
@EnableRabbit  //使用RabbitListener消费必须加入此关键字
@PropertySource("classpath:app.properties")//用于消费的第三者方式SimpleMessageHandle的测试
public class MqConsumerApplication {
	public static void main(String[] args) {
		new SpringApplicationBuilder(MqConsumerApplication.class).web(true).run(args);

	}
	//spring stream的方式消费消息
	// 监听 binding 为 Sink.INPUT 的消息
    @StreamListener(Sink.INPUT)
    public void input(byte[] ms) {
        System.out.println("一般监听收到：" +new String(ms));
    }

}
